import lineImg from '@/assets/show-type/line.png'
import stepLine from '@/assets/show-type/stepLine.png'
import bar from '@/assets/show-type/bar.png'
import groupBar from '@/assets/show-type/groupBar.png'
import stackBar from '@/assets/show-type/stackBar.png'

import column from '@/assets/show-type/column.png'
import stackColumn from '@/assets/show-type/stackColumn.png'
import groupColumn from '@/assets/show-type/groupColumn.png'

import pie from '@/assets/show-type/pie.png'
import ring from '@/assets/show-type/ring.png'
import radar from '@/assets/show-type/radar.png'
import liquid from '@/assets/show-type/liquid.png'
import gauge from '@/assets/show-type/gauge.png'

import funnel from '@/assets/show-type/funnel.png'

import wordCloud from '@/assets/show-type/wordCloud.png'

import table from '@/assets/show-type/table.png'


const showType = [{
  name: '折线图',
  type: 'line',
  icon: '',
  image: lineImg,
  group: 'chart',
  sourceType: 'line',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
},{
  name: '阶梯折线图',
  type: 'stepLine',
  icon: '',
  image: stepLine,
  group: 'chart',
  sourceType: 'line',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '面积图',
  type: 'area',
  icon: '',
  image: '',
  sourceType: 'area',
  group: 'chart',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '堆叠面积图',
  type: 'stackArea',
  icon: '',
  image: '',
  sourceType: 'area',
  group: 'chart',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '条形图',
  type: 'bar',
  icon: '',
  image: bar,
  group: 'chart',
  sourceType: 'bar',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '分组条形图',
  type: 'groupBar',
  icon: '',
  image: groupBar,
  sourceType: 'bar',
  group: 'chart',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '堆叠条形图',
  type: 'stackBar',
  icon: '',
  image: stackBar,
  sourceType: 'bar',
  group: 'chart',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '柱状图',
  type: 'column',
  icon: '',
  image: column,
  group: 'chart',
  sourceType: 'column',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '分组柱状图',
  type: 'groupColumn',
  icon: '',
  image: groupColumn,
  sourceType: 'column',
  group: 'chart',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '堆叠柱状图',
  type: 'stackColumn',
  icon: '',
  image: stackColumn,
  sourceType: 'column',
  group: 'chart',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '词云图',
  type: 'wordCloud',
  icon: '',
  image: wordCloud,
  group: 'chart',
  sourceType: 'other',
  attribute: {
    width: 6,
    height: 6,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '饼图',
  type: 'pie',
  icon: '',
  image: pie,
  group: 'chart',
  sourceType: 'pie',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '环图',
  type: 'ring',
  icon: '',
  image: ring,
  group: 'chart',
  sourceType: 'pie',
  attribute: {
    width: 6,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
},
{
  name: '漏斗图',
  type: 'funnel',
  icon: '',
  image: funnel,
  group: 'chart',
  sourceType: 'funnel',
  attribute: {
    width: 4,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
},
// {
//   name: '双轴图',
//   type: 'dualAxes',
//   icon: '',
//   image: '',
//   group: 'chart',
//   attribute: {
//     width: 6,
//     height: 4
//   }
// }, 
 {
  name: '雷达图',
  type: 'radar',
  icon: '',
  image: radar,
  group: 'chart',
  sourceType: 'other',
  attribute: {
    width: 4,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
},
{
  name: '水波图',
  type: 'liquid',
  icon: '',
  image: liquid,
  group: 'chart',
  sourceType: 'speed',
  attribute: {
    width: 3,
    height: 3,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '仪表盘图',
  type: 'gauge',
  icon: '',
  image: gauge,
  group: 'chart',
  sourceType: 'speed',
  attribute: {
    width: 3,
    height: 3,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '数字图',
  type: 'number',
  icon: '',
  image: '',
  group: 'chart',
  sourceType: 'number',
  attribute: {
    width: 3,
    height: 2,
    maxWidth: 4,
    maxHeight: 3,
    minWidth: 2,
    minHeight: 2
  }
}, {
  name: '多数字图',
  type: 'multipleNumber',
  icon: '',
  image: '',
  group: 'chart',
  sourceType: 'number',
  attribute: {
    width: 12,
    height: 2,
    maxWidth: 12,
    maxHeight: 3,
    minWidth: 3,
    minHeight: 2
  }
}, {
  name: '数字趋势图',
  type: 'trendNumber',
  icon: '',
  image: '',
  group: 'chart',
  sourceType: 'number',
  attribute: {
    width: 4,
    height: 3,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 2
  }
}, {
  name: 'markdown',
  type: 'markdown',
  icon: '',
  image: '',
  group: 'markdown',
  attribute: {
    width: 12,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
}, {
  name: '轮播图',
  type: 'carousel',
  icon: '',
  image: '',
  group: 'image',
  attribute: {
    width: 5,
    height: 3,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 3,
    minHeight: 3
  }
},{
  name: '基础表格',
  type: 'table',
  icon: '',
  image: table,
  group: 'table',
  attribute: {
    width: 12,
    height: 5,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 5,
    minHeight: 3
  }
}, {
  name: '思维导图',
  type: 'mindMap',
  icon: '',
  image: '',
  group: 'drawing',
  attribute: {
    width: 12,
    height: 4,
    maxWidth: 12,
    maxHeight: 12,
    minWidth: 6,
    minHeight: 3
  }
}]

const groupType = [{
  name: '图表',
  type: 'chart'
}, {
  name: '表格',
  type: 'table'
}, {
  name: '图片',
  type: 'image'
}, 
// {
//   name: '关系图',
//   type: 'drawing'
// }, 
{
  name: 'markdown',
  type: 'markdown'
}]

const chartType = [{
  name: '折线图类',
  type: 'line'
}, {
  namae: '面积图类',
  type: 'area'
} , {
  name: '柱状图类',
  type: 'column'
}, {
  name: '条形图类',
  type: 'bar'
}, {
  name: '饼图类',
  type: 'pie'
}, {
  name: '漏斗类',
  type: 'funnel'
}, {
  name: '数字图类',
  type: 'number'
}, {
  name: '进度图类',
  type: 'speed'
}, {
  name: '其他图类',
  type: 'other'
}]

const showTypeMap = {}
showType.forEach(o => {
  showTypeMap[o.type] = o
})

export { showType, groupType, showTypeMap }

export const moduleList = () => {
  let arr = []
  groupType.forEach(o => {
    let obj = {...o, children: []}
    if (o.type === 'chart') {
      chartType.forEach(v => {
        let chartObj = {
          groupName: v.name,
          children: []
        }
        showType.forEach(c => {
          if (v.type === c.sourceType) {
            chartObj.children.push(c)
          }
        })
        obj.children.push(chartObj)
      })
    } else {
      showType.forEach(v => {
        if (v.group === o.type) {
          obj.children.push(v)
        }
      })
    }
    arr.push(obj)
  })
  return arr
}